import React from 'react'
import {Button} from "antd";
import { useSelector , useDispatch} from "react-redux";
import { setName , setAge } from "../../store/features/taskSlice";

const Dom8 = () => {
    const { name , age} = useSelector(store => store.task)
    const dispatch = useDispatch()
    const editName = () => {
        dispatch(setName('彦祖'))
    }
    const editAge = () => {
        dispatch(setAge(age+1))
    }
    return <div>

        <div>{ name }</div>
        <div>{ age }</div>
        <Button onClick={ editName }>NameClick</Button>
        <Button onClick={ editAge }>ageClick</Button>
    </div>
}

export default Dom8
